package com.fqgj.sentry.controller.rm;

import com.fqgj.sentry.biz.rm.OverdueStatisticsBusiness;
import com.fqgj.sentry.biz.rm.vo.OverdueRiskCharVo;
import com.fqgj.sentry.biz.rm.vo.OverdueRiskTableVo;
import com.fqgj.sentry.common.annotations.ParamsValidate;
import com.fqgj.sentry.common.response.ApiOutput;
import com.fqgj.sentry.controller.rm.request.OverdueQueryTermsRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by ykpbean kangping.ying@yuntu-inc.com
 *
 * @description
 * @create 2017-10-13 下午4:08
 */

@RestController
@RequestMapping(value = "/risk/overdue")
public class OverdueStatisticsController {
    @Autowired
    private OverdueStatisticsBusiness overdueStatisticsBusiness;

    @ParamsValidate
    @RequestMapping(value = "/table", method = RequestMethod.POST)
    public ApiOutput findOverdueStatisticsTable(@RequestBody OverdueQueryTermsRequest overdueQueryTermsRequest) {
        OverdueRiskTableVo overdueRiskTableVo = overdueStatisticsBusiness.getOverdueStatisticTable(overdueQueryTermsRequest);
        return new ApiOutput<>(overdueRiskTableVo);
    }

    @ParamsValidate
    @RequestMapping(value = "/chart", method = RequestMethod.POST)
    public ApiOutput findOverdueStatisticsChart(@RequestBody OverdueQueryTermsRequest overdueQueryTermsRequest) {
        OverdueRiskCharVo overdueRiskCharVo = overdueStatisticsBusiness.getOverdueStatisticChart(overdueQueryTermsRequest);
        return new ApiOutput<>(overdueRiskCharVo);
    }
}
